package main

import (
	"getCapCha/handler"
	getCapCha "getCapCha/proto/getCapCha"
	"github.com/micro/go-micro"
	"github.com/micro/go-micro/util/log"
	"github.com/micro/go-plugins/registry/consul"
)

func main() {
	// 初始化consul对象
	consulReg := consul.NewRegistry()
	// 添加consul到micro.NewService

	// 启动consul

	// New Service
	service := micro.NewService(
		micro.Address("127.0.0.1:12341"), // 防止随机生成port
		micro.Name("getCapCha"),
		micro.Registry(consulReg), // 添加注册
		micro.Version("latest"),
	)

	// Register Handler
	getCapCha.RegisterGetCapChaHandler(service.Server(), new(handler.GetCapCha))

	// Run service
	if err := service.Run(); err != nil {
		log.Fatal(err)
	}
}
